from selenium.webdriver.common.by import By
from page_objects.Shangjia_page import ShangjiaPage

class JiueSuanPage(ShangjiaPage):
    # 元素定位器（私有，只在当前页面使用）
    # 1.定位结算管理
    js_manger_loc=(By.XPATH,'/html/body/div[1]/div[2]/div[2]/div[2]/div[11]/h2')
    # 2.定位结算记录管理
    js_jl_loc=(By.XPATH,'/html/body/div[1]/div[2]/div[2]/div[2]/div[12]/ul/li/div/a')
    # 2.定位发起结算
    js_fq_loc=(By.XPATH,'/html/body/div[1]/div[3]/div/div[2]/div[2]/div[2]/div[1]/ul/li[1]/a/span')
    # 2.定位用户编号输入框
    js_user_no_loc=(By.ID,'userNo')
    # 3.定位用户名输入框
    js_username_loc=(By.XPATH,'/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[2]/dd')
    # 4.定位可结算余额输入框
    js_yue_loc=(By.ID,'settAmount')
    # 5.定位可结算金额输入框
    js_money_loc=(By.XPATH,'/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[1]/div/fieldset/dl[4]/dd/input')
    # 6.定位结算提交按钮
    js_commit_loc=(By.XPATH,'/html/body/div[1]/div[3]/div/div[2]/div[3]/div/form/div[2]/ul/li[1]/div/div/button')

    # 元素的操作方法
    # 1.点击结算管理
    def click_js_manger(self):
        self.click(self.js_manger_loc)
        return self
    # 2.点击结算记录管理
    def click_js_jl(self):
        self.click(self.js_jl_loc)
        return self
    # 3.点击发起结算
    def click_fq_js(self):
        self.click(self.js_fq_loc)
        return self
    # 4.输入用户编号
    def js_input_user_no(self,user_no):
        self.send_keys(self.js_user_no_loc,user_no)
        return self
    # 4.输入用户编号
    def js_input_user_name(self, user_name):
        self.send_keys(self.js_username_loc, user_name)
        return self
    # 5.输入可结算余额
    def js_yue(self,yue):
        self.send_keys(self.js_yue_loc,yue)
        return self
    # 6.输入可结算余额
    def js_money(self,money):
        self.send_keys(self.js_money_loc,money)
        return self
    # 7.点击提交
    def click_commit_js(self):
        self.click(self.js_commit_loc)
        return self